#include <bits/stdc++.h>
#define int long long
using namespace std;

inline int read() {
	int x = 0, f = 0; char ch = getchar();
	while (ch < '0' or ch > '9') f |= (ch == '-'), ch = getchar();
	while (ch >= '0' and ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

int __stk[128], __top;
inline void write(int x) {
    if(x < 0) putchar('-'), x = -x;
	do { __stk[++__top] = x % 10, x /= 10; } while (x);
	while (__top) putchar(__stk[__top--] + '0');
}

const int mod = 998244353;

void Min(int &x, int y) { y < x and (x = y); }
void Max(int &x, int y) { y > x and (x = y); }

void inc(int &x, int y) { (x += y) >= mod and (x -= mod); }
void mul(int &x, int y) { x = 1ll * x * y % mod; }

int q_pow(int x, int k) { int res = 1; for (; k; k >>= 1, mul(x, x)) if (k & 1) mul(res, x); return res; }

bool stmer;

const int N = 3e5 + 10, inf = 1e18;

int n, m, a, b;
int f[N][2];

unordered_set<int> mp;
vector<int> e[N];

namespace sub1 {
    int fa[N], d[N];

    void dfs(int x) {
        if (x > 1) d[x] = d[fa[x]] + a;
        if (fa[fa[x]]) Min(d[x], d[fa[fa[x]]] + b);
        for (int v : e[x]) if (v ^ fa[x]) fa[v] = x, dfs(v);
    }

    void main() {
        dfs(1);
        for (int i = 2; i <= n; i++) write(d[i]), putchar('\n');
    }
}

namespace sub2 {
    int f[N][2];

    struct node {
        int x, d, k, fr;
        bool operator < (const node &p) const { return d > p.d; }
    };

    priority_queue<node> q;

    void main() {
        for (int i = 1; i <= n; i++) f[i][0] = f[i][1] = inf;
        f[1][0] = 0, q.push({ 1, 0, 0, 0 });
        while (!q.empty()) {
            node l = q.top(); q.pop();
            if (l.d > f[l.x][l.k & 1]) continue;
            for (int v : e[l.x]) if (v != l.fr and l.d + a * l.k <= f[v][1]) 
                f[v][1] = l.d + a * l.k, q.push({ v, l.d + a * l.k, 1, l.x });
            if (l.k == 1) {
                for (int v : e[l.x]) if (!mp.count({ l.fr * n + v}) and l.d + b <= f[v][0]) 
                    f[v][0] = l.d + b, q.push({ v, l.d + b, 0, 0 });
            }
        }
        for (int i = 2; i <= n; i++) write(min(f[i][0], f[i][1] + a)), putchar('\n');
    }
}

namespace sub3 {
    int f[N][2];

    struct node {
        int x, d, k, fr;
        bool operator < (const node &p) const { return d > p.d; }
    };

    priority_queue<node> q;

    void main() {
        for (int i = 1; i <= n; i++) f[i][0] = f[i][1] = inf;
        f[1][0] = 0, q.push({ 1, 0, 0, 0 });
        while (!q.empty()) {
            node l = q.top(); q.pop();
            if (l.d > f[l.x][l.k & 1]) continue;
            for (int v : e[l.x]) if (v != l.fr and l.d + a * l.k < f[v][1]) 
                f[v][1] = l.d + a * l.k, q.push({ v, l.d + a * l.k, 1, l.x });
            if (l.k == 1) {
                for (int v : e[l.x]) if (l.d + b < f[v][0]) 
                    f[v][0] = l.d + b, q.push({ v, l.d + b, 0, 0 });
            }
        }
        for (int i = 2; i <= n; i++) write(min(f[i][0], f[i][1] + a)), putchar('\n');
    }
}

bool edmer;
signed main() {
	freopen("edge.in", "r", stdin);
	freopen("edge.out", "w", stdout);
	cerr << "[Memory] " << (&stmer - &edmer) / 1024 / 1024 << " MB\n";
    
    n = read(), m = read(), a = read(), b = read();
    for (int i = 1; i <= m; i++) {
        int u = read(), v = read();
        e[u].push_back(v), e[v].push_back(u);
        mp.insert(u * n + v), mp.insert(v * n + u);
    }

    if (m == n - 1) sub1 :: main();
    else if (m <= 1000) sub2 :: main();
    else if (b >= a) sub3 :: main();
    else sub2 :: main();

    cerr << "[Runtime] " << (double) clock() / CLOCKS_PER_SEC << " seconds\n";
	return 0;
} 